import { existsSync, readFileSync } from 'fs';
import { IProxy } from './build/server';

const VERSION = readFileSync('version.txt').toString().split(',');

const selfConfig = {};

if (existsSync('./selfConfig.js')) {
	try {
		Object.assign(selfConfig, require('./selfConfig.js'));
	} catch (e) {
		console.error(e);
	}
}

export default Object.assign(
	{
		port: 8888,
		useSourceMap: false,
		staticRoot: '/template/',
		projectVersion: VERSION[0].trim(),
		projectBuildDate: VERSION[1].trim(),
		proxy: [
			{
				match: '/api',
				target: 'https://www.baidu.com',
			},
		] as IProxy[],
	},
	selfConfig
);
